<?php

class Manager extends Eloquent {
	protected $table;
	public $timestamps = false;
	
	/********************************************************************************
	 ******************************** PUBLIC FUNCTIONS ******************************
	 ********************************************************************************/
	
	/**
	 * ses the table for the model
	 */
	public function __construct() {
		$this->table = Helper::getDB ('gastro') . 'manager';
	}
	
	
	/**********************************************************************
	 ************************** HAS MANY RELATIONS ************************
	 **********************************************************************/
	
	/**
	 * returns all locations where the manager is used in
	 * @param		array
	 */
	public function locations(){
		$this->belongsToMany('Location', (Helper::getDB('gastro') . 'location_manager'), 'manager_id', 'location_id')->withPivot('isReservationManager');
	}
	
	
	/**********************************************************************
	 ************************* BELONGS TO RELATIONS ***********************
	 **********************************************************************/
	
	/**
	 * returns the person
	 * @return		mixed
	 */
	public function person(){
		return $this->belongsTo('Person', 'person_id');
	}
	
	
	/**
	 * returns the customer
	 * @return		mixed
	 */
	public function customer(){
		return $this->belongsTo('Customer', 'customer_id');
	}

}